package com.boot2.core.model;

import com.boot2.core.LongBaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @ClassName: SysLog
 * @Description: 【】 model
 * @author zhangweilin
 * @date 2019-9-9 14:24:47
 *
 */
@ApiModel("")
@Data
@ToString(callSuper = true)
@Entity
@Table(name = "sys_log")
@SQLDelete(sql = "update sys_log set is_deleted = id where id = ?")
@Where(clause = "is_deleted = 0 or is_deleted is null ")
@DynamicInsert // 加上此注解，可以只添加有值的字段
@DynamicUpdate // 此注解，是指，会先查，然后跟参数对比，不一样的就更新，所以并不是有值更新，如果db中有值，参数里没值，那么db中的值会清空
public class SysLog extends LongBaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public SysLog() {
		super();
	}
	
	public SysLog(Long id) {
		this.id = id;
	}

	/**
	 *  @param isInit  是否初始化基础信息
	 */
	public SysLog(boolean isInit) {
		super(isInit);
	}
	/**
	 * 日志类型
	 */
	@ApiModelProperty(value = "日志类型")
	private Integer type;

	/**
	 * 日志类型
	 */
	@ApiModelProperty(value = "日志类型文本描述")
	private String typeText;
	/**
	 * 日志描述
	 */
	@ApiModelProperty(value = "日志描述")
	private String description;

	/**
	 * 操作的数据
	 */
	@ApiModelProperty(value = "操作的数据")
	private String value;
}
